/*    */ package com.zimbra.cs.mailbox;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import java.io.IOException;
/*    */ import java.io.InputStream;
/*    */ import java.io.OutputStream;
/*    */ import javax.activation.DataSource;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class DocumentDataSource
/*    */   implements DataSource
/*    */ {
/*    */   private Document mDocument;
/*    */   
/*    */   public DocumentDataSource(Document document)
/*    */   {
/* 34 */     if (document == null) {
/* 35 */       throw new NullPointerException("document cannot be null");
/*    */     }
/* 37 */     this.mDocument = document;
/*    */   }
/*    */   
/*    */   public String getContentType() {
/* 41 */     return this.mDocument.getContentType();
/*    */   }
/*    */   
/*    */   public InputStream getInputStream() throws IOException {
/*    */     try {
/* 46 */       return this.mDocument.getContentStream();
/*    */     } catch (ServiceException e) {
/* 48 */       ZimbraLog.mailbox.error("Unable to get document content", e);
/* 49 */       throw new IOException(e.toString());
/*    */     }
/*    */   }
/*    */   
/*    */   public String getName() {
/* 54 */     return this.mDocument.getName();
/*    */   }
/*    */   
/*    */   public OutputStream getOutputStream() {
/* 58 */     throw new UnsupportedOperationException();
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/mailbox/DocumentDataSource.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */